<template>
    <view class="">
        <view class="pageContainer">
            <image v-for="(item,index) in imageList" :key="index" @click="previewImg(index)" class="imageContainer" :src="item" mode=""></image>
        </view>
        <view class="" style="height: 200rpx;">
            
        </view>
        <share-button :backgroundBtn="'#5E9FFD'"
			@onShare="onShare"
        ></share-button>
    </view>

</template>

<script>
    const api = require("@/static/js/api.js")
    const utils = require("@/static/js/utils.js")

    import {
        mapState,
        mapMutations,
        mapActions
    } from 'vuex';
    let that = null

    
	export default {
		data() {
			return {
                detailId:'',
                imageList:[],
                detailObj:{},
			};
		},
        
        computed: {
            ...mapState({
                hasLogin: state => state.userInfo.hasLogin,
                isAuthPhone: state => state.userInfo.isAuthPhone,
                isAuthUserInfo: state => state.userInfo.isAuthUserInfo, 
                isSeller: state => state.userInfo.isSeller,
                sellerObj: state => state.userInfo.sellerObj,
                buyerObj: state => state.userInfo.buyerObj,
                shopInfo: state => state.userInfo.shopInfo,
            }),
        },
        components: {
            
        },
        onLoad(options) {
            that = this;
            if (options.id){
                that.detailId = options.id;
                that.getProjectAlbumDetail();
            }
        },
        onShow() {
      
        },
        methods:{ 
            ...mapMutations(['setUserInfo', 'setLoginStatus', 'setUserId',"setOrigin"]),

            getProjectAlbumDetail() {
                let that = this
                api.getProjectAlbumDetail({
                    param: {
                        id: that.detailId,
                    }
                }).then(res => {
                    console.log(res)
                    if (res.success) {  
                        that.imageList = res.data.images
                        if (res.data.name&&res.data.name.length>0){
                            uni.setNavigationBarTitle({
                            	title: res.data.name+'相册'
                            })
                        }
                        that.detailObj = res.data;
						
						that.shareTitleMixins = that.detailObj.name+'相册'
						that.shareImageMixins = that.detailObj.cover; 
                    }
                })
            },
            
            previewImg(index) {
          	
            	uni.previewImage({
            		current: index,
            		urls: that.imageList,
            	});
            }
        }
	}
</script>

<style lang="scss">
    page{
        background-color: #FFFFFF;
    }
    .pageContainer{
        width: 750rpx;
        display: flex;
        flex-wrap: wrap;
    }
    .imageContainer{
        width: 240rpx;
        height: 240rpx;
        background-color: #F3F3F3;
        margin-left: 5rpx;
        margin-right: 5rpx;
        margin-bottom: 10rpx;
    }
</style>
